<template>
    <div>
        <slot></slot>
    </div>
</template>

<script>
    export default {
        provide() {
            return {
                Form: this
            }
        },
        props: {
            model: {
                type: Object,
                default() {
                    return {}
                },
                required: true
            },
            rules: {
                type: Object,
            }
        },
        methods: {
            validate(cb) {
                const tasks = this.$children.filter(item => {
                    return item.prop
                }).map(item => {
                    return item.validator();
                })
                console.log(tasks)
                Promise.all(tasks).then(() => cb(true)).catch(() => cb(false));
            }
        }
    }
</script>

<style scoped>

</style>